<html>
  <head></head>
  <body>
    <div id="game"></div>
    <script type="text/javascript" src="https://rawgithub.com/craftyjs/Crafty/release/dist/crafty-min.js"></script>
    <script>
	
	  Crafty.init(300,300, document.getElementById('game'));
		
	  Crafty.e('Floor, 2D, Canvas, Color')
	  .attr({x: 0, y: 250, w: 500, h: 10})
	  .color('green');
	  
	  Crafty.e('2D, Canvas, Color, Twoway, Gravity')
	  .attr({x: 0, y: 0, w: 50, h: 50})
	  .color('#F00')
	  .twoway(200) // 速度
	  .gravity('Floor'); //自动下滑 定义能被floor接住
	  
	  Crafty.e('2D, Canvas, Color, Twoway, Gravity')
	  .attr({x: 100, y: 0, w: 50, h: 50})
	  .color('#F00')
	  .twoway(200)
	  .gravity();  //自动下滑 定义不能被floor接住
	  
    </script>
  </body>
</html>